#include "common.h"

int A[10000], B[10000], n;

int main() {
    LARGE_INTEGER t1,t2,tc;
    double time;
    std::vector<std::string> filename {"../in10.txt", "../in1000.txt", "../in10000.txt",
                                       "../out10.txt", "../out1000.txt", "../out10000.txt"};

    for (int i = 0; i < 3; i++)
    {
        ReadArr(filename[i], A, B, n);

        std::cout<<"Test case : "<<filename[i]<<std::endl;

        QueryPerformanceFrequency(&tc);
        QueryPerformanceCounter(&t1);

        HeapSort(A, n); // 堆排序

        QueryPerformanceCounter(&t2);
        time=(double)(t2.QuadPart-t1.QuadPart)/(double)tc.QuadPart;

        std::cout<<"HeapSort time = "<<time<<" s"<<std::endl;  // 输出时间(单位: s)

        QueryPerformanceFrequency(&tc);
        QueryPerformanceCounter(&t1);

        QuickSort(B, n); // 快速排序

        QueryPerformanceCounter(&t2);
        time=(double)(t2.QuadPart-t1.QuadPart)/(double)tc.QuadPart;

        std::cout<<"QuickSort time = "<<time<<" s"<<std::endl;  // 输出时间(单位: s)

        WriteArr(filename[i + 3], A, n);
    }

    return 0;
}
